package com.yh.controller;

import com.yh.service.IBordService;
import com.yh.service.impl.BordService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class BordServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
                    String title=request.getParameter("keyword");
                    IBordService ids=new BordService();
                    if (title!=""){
                        JSONArray jsa =ids.keyWord(title);
                        PrintWriter out=response.getWriter();
                        out.print(jsa);
                    }




    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
